#pragma once
#include "rtdev/servo/servoitf.h"
namespace rtbus {
class RtCommuItf;
}
namespace rtdev {
class JkServo : public ServoItf
{
public:
    JkServo();

    int boot() override;
    int shutdown() override;
    int set_send_data(int busid) override;
    int get_recv_data(int busid) override;
    int get_sdo_blocking(uint32_t objid, void* data, int s, int retry) override;
    int set_sdo_blocking(uint32_t objid, void* data, size_t s, void* readback, int retry) override;
    uint16_t handle_control_word(uint16_t sword, bool has_ext_enable_bit);
    int set_opt(std::string opt_name, void* data, size_t s) override;

public:
    virtual bool is_enable() override;
    virtual bool is_homed() override;
    virtual uint32_t get_act_collision_lv() override;
    virtual bool is_tor_overload() override;
    virtual bool is_backdrive() override;
    virtual bool is_collision() override;

private:
    bool last_alive_ = false;
    uint32_t cmd_collision_lv_ = 0;
    uint32_t is_dyn_forward_ = 0;
};
}  // namespace rtdev
